<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>后台管理页面</title>
<meta name="description" content="后台管理页面">
<meta name="keywords" content="index">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="__PUBLIC__/assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed" href="__PUBLIC__/assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="stylesheet" href="__PUBLIC__/assets/css/amazeui.min.css"/>
<link rel="stylesheet" href="__PUBLIC__/assets/css/admin.css">
<script src="__PUBLIC__/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/assets/js/app.js"></script>
</head>

<script type="text/javascript">
function getxmlrequest(){
  if(XMLHttpRequest == "undefined"){
    XMLHttpRequest = function(){
      try{return new ActiveXObject("Msxml2.XMLHTTP.6.0");}
      catch(e){}
      try{return new ActiveXObject("Msxml2.XMLHTTP.3.0");}
      catch(e){}
      try{return new ActiveXObject("Msxml2.XMLHTTP");}
      catch(e){}
      try{return new ActiveXObject("Microsoft.XMLHTTP");}
      catch(e){}
      return false;
    }
  }
  return new XMLHttpRequest();
}

function updateData(id){
  var request = getxmlrequest();
  if(request){
    request.open("GET","findclass?id="+id,true);
    request.onreadystatechange = function(){

      if(request.readyState == 4){
        var info = request.responseText; 
        var obj = document.getElementById("my-popups");
        var inputObj = obj.getElementsByTagName("input");
        var textArea = obj.getElementsByTagName("textarea");
        var json = JSON.parse(info);
        var data = json[0];      
        inputObj[0].setAttribute("value",data.classid);
        inputObj[1].setAttribute("value",data.classname);
        inputObj[2].setAttribute("value",data.classpic);
        inputObj[3].setAttribute("value",data.classcost);
        inputObj[4].setAttribute("value",data.address);
        inputObj[5].setAttribute("value",data.time);
        inputObj[6].setAttribute("value",data.difficulty);
        inputObj[7].setAttribute("value",data.people);
   
      }
    };
     request.send();  
  }else{
    alert("不支持ajax");
  }
}
</script>


<body>
<header class="am-topbar admin-header">
  <div class="am-topbar-brand"><img src="__PUBLIC__/assets/i/logo.png"></div>
  <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
    <ul class="am-nav am-nav-pills am-topbar-nav admin-header-list">
      <li class="am-dropdown tognzhi" data-am-dropdown>
        
<!-- 
        <p class="ycfg">
          <input type="text" class="am-form-field am-input-sm" placeholder="圆角表单域" />
        </p>
        <p>
          <button class="am-btn am-btn-xs am-btn-default am-xiao"><i class="am-icon-search"></i></button>搜索框
        </p> -->
      </li>
      <li class="am-hide-sm-only" style="float: right;"><a href="javascript:;" id="admin-fullscreen"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
    </ul>
  </div>
</header>
<div class="am-cf admin-main">
  <div class="nav-navicon admin-main admin-sidebar">
    <div class="sideMenu am-icon-dashboard" style="color:#aeb2b7; margin: 10px 0 0 0;"> 欢迎系统管理员：hello</div>
    <div class="sideMenu">
      <h3 class="am-icon-flag"><em></em> <a href="#">俱乐部管理</a></h3>
      <h3 class="am-icon-cart-plus"><em></em> <a href="{:U('clubadmin/clubadmin')}">俱乐部负责人</a></h3>
      <h3 class="am-icon-users"><em></em> <a href="{:U('Class/classlist')}">课程管理</a></h3>
      <h3 class="am-icon-volume-up"><em></em> <a href="#">信息通知</a></h3>
      <h3 class="am-icon-gears"><em></em> <a href="#">系统设置</a></h3>
      <h3 class="am-icon-gears"><em></em> <a href="#">系统设置</a></h3>
      <h3 class="am-icon-gears"><em></em> <a href="#">系统设置</a></h3>
      <h3 class="am-icon-gears"><em></em> <a href="#">系统设置</a></h3>

    </div>
    <!-- sideMenu End --> 
    
    <script type="text/javascript">
      jQuery(".sideMenu").slide({
        titCell:"h3", //鼠标触发对象
        targetCell:"ul", //与titCell一一对应，第n个titCell控制第n个targetCell的显示隐藏
        effect:"slideDown", //targetCell下拉效果
        delayTime:300 , //效果时间
        triggerTime:150, //鼠标延迟触发时间（默认150）
        defaultPlay:true,//默认是否执行效果（默认true）
        returnDefault:false //鼠标从.sideMen移走后返回默认状态（默认false）
        });
    </script> 
  </div>
  <div class=" admin-content">
    <div class="daohang">
      <ul>
        <li>
        <button type="button" class="am-btn am-btn-default am-radius am-btn-xs">
        首页
        </li>
      </ul>
    </div>
    <div class="am-popup am-popup-inner" id="my-popup">
      <div class="am-popup-hd">
        <h4 class="am-popup-title">添加课程</h4>
        <span data-am-modal-close
            class="am-close">&times;</span> 
            </div>
      <div class="am-popup-bd">
        <form class="am-form tjlanmu" method="post" action="{:U('class/add')} " enctype="multipart/form-data">
          <div class="am-form-group" >
            <div class="zuo">课程名：</div>
            <div class="you">
              <input type="text" class="" id="classname" placeholder="请输入课程名" name="name">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">课程图片：</div>
            <div class="you" style="height: 45px;">
              <input type="file" id="classnpic" name="classpic">
              <p class="am-form-help">请选择要上传的文件...</p>
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">价格</div>
            <div class="you">
             <input type="text"  id="classcost" name="classcost">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">上课地点</div>
            <div class="you">
              <input type="text" class=""  id="address" name="address">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">上课时间</div>
            <div class="you">
              <input type="text" type="input"  id="time" name="time">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">难易度</div>
            <div class="you">
              <input type="text" class="" id="difficulty" name="difficulty">
            </div>
          </div>

          <div class="am-form-group am-cf">
            <div class="you">
              <p>
                <button type="submit" class="am-btn am-btn-success am-radius" >提交</button>
              </p>
            </div>
          </div>
        </form>
      </div>
    </div>
    
          <div class="am-popup am-popup-inner" id="my-popups">
        <div class="am-popup-hd">
          <h4 class="am-popup-title">修改课程</h4>
          <span data-am-modal-close class="am-close">&times;</span> </div>
        <div class="am-popup-bd">
          <form class="am-form tjlanmu" method="post" action="{:U('class/update')} " enctype="multipart/form-data">
          <input type="hidden" name="cid" />
            <div class="am-form-group">
              <div class="zuo">课程名：</div>
              <div class="you">
                 <input type="text" class="" id="club_adminname" placeholder="请输入用户名" name="name">
              </div>
            </div>
           <div class="am-form-group am-cf">
            <div class="zuo">课程图片：</div>
            <div class="you" style="height: 45px;">
              <input type="file" id="classnpic" name="pic">
              <p class="am-form-help">请选择要上传的文件...</p>
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">价格</div>
            <div class="you">
             <input type="text"  id="classcost" name="classcost">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">上课地点</div>
            <div class="you">
              <input type="text" class=""  id="address" name="address">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">上课时间</div>
            <div class="you">
              <input type="text" type="input"  id="time" name="time">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">难易度</div>
            <div class="you">
              <input type="text" class="" id="difficulty" name="difficulty">
            </div>
          </div>

            <div class="am-form-group am-cf">
              <div class="you">
                <p>
                   <button type="submit" class="am-btn am-btn-success am-radius" >提交</button>
                </p>
              </div>
            </div>
          </form>
        </div>
      </div>

    <div class="admin-biaogelist">
      <div class="listbiaoti am-cf">
        <ul class="am-icon-flag on">
          课程管理
        </ul>
        <dl class="am-icon-home" style="float: right;">
          当前位置： 首页 > <a href="#">课程管理</a>
        </dl>
        <dl>
          <button type="button" class="am-btn am-btn-danger am-round am-btn-xs am-icon-plus" data-am-modal="{target: '#my-popup'}"> 添加</button>
        </dl>

        
      </div>
      <form class="am-form am-g">
        <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
          <thead>
            <tr class="am-success">

              <th >序号</th>
              <th >课程名</th>
              <th class="table-type">课程图片</th>
              <th class="table-author am-hide-sm-only">价格</th>
              <th >上课地点</th>
              <th >上课时间</th>
              <th >难易度</th>
              <th >报名人数</th>
              <th  class="table-set">操作</th>
            </tr>
          </thead>
          <tbody>
          <volist name="class" id="vo">
              <tr>
           <td >{$vo.classid}</td>
           <td>{$vo.classname}</td>
           <td><img src="__PUBLIC__/photo/class/{$vo.classpic}" width="50"></td>
           <td>{$vo.classcost}</td>
           <td>{$vo.address}</td>
           <td>{$vo.time}</td>
           <td>{$vo.difficulty}</td>
           <td>{$vo.people}</td>
            <td><div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                     <a class="am-btn am-btn-default am-btn-xs am-text-success am-round am-icon-file" data-am-modal="{target: '#my-popups'}"  title="修改"  onclick="updateData({$vo.classid})" ></a>
                     <a href="{:U('delete',array('classid'=>$vo['classid']))}" onclick="return confirm('你确定要删除吗？')" class="am-btn am-btn-default am-btn-xs am-text-danger am-round"><i class="icon-remove"></i><span class="am-icon-trash-o"></span></a>
                  </div>
                </div></td>
            </tr></volist>
 
          </tbody>
        </table>


        <hr />
        
      </form>

      <div class="foods">
        <ul>
           约健，给你美好未来
        </ul>
        <dl>
          <a href="" title="返回头部" class="am-icon-btn am-icon-arrow-up"></a>
        </dl>
      </div>
    </div>
  </div>
</div>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="__PUBLIC__/assets/js/polyfill/rem.min.js"></script>
<script src="__PUBLIC__/assets/js/polyfill/respond.min.js"></script>
<script src="__PUBLIC__/assets/js/amazeui.legacy.js"></script>
<![endif]--> 

<!--[if (gte IE 9)|!(IE)]><!--> 
<script src="__PUBLIC__/assets/js/amazeui.min.js"></script> 
<!--<![endif]-->

</body>
</html>